<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8"/>
    <title>Font Awesome Ico list</title>
    <link rel="stylesheet" href="/plugins/font-awesome-4.7.0/css/font-awesome.min.css"/>
    <link rel="stylesheet" href="/plugins/layui/dist/css/layui.css"/>
    <link rel="stylesheet" href="/plugins/bootstrap/css/bootstrap.min.css"/>
    <script src="/plugins/jquery/jquery-2.2.4.min.js"></script>
    <script src="/js/common/sinoUtil.js"></script>
    <script src="/plugins/layui/dist/lay/modules/layer.js"></script>
</head>
<body>
<div id="function-list"></div>
<script type="text/javascript">
    var index = parent.layer.getFrameIndex(window.name);
    sinoUtil.sendHttp(sinoUtil.httpPrefix + "/api-system/getAllFunctions", "POST", {}, function (res) {
        if(res.status == 0){
            for(var i=0; i<res.data.length; i++){
                var span = document.createElement("span");
                span.setAttribute("id", res.data[i].functionRightCode);
                span.innerHTML = res.data[i].functionName;
                span.setAttribute("style", "margin-bottom: 10px;margin-top: 5px;cursor: pointer;");
                span.setAttribute("class", "label label-success col-xs-6");
                span.onclick = function(){
                    // 给父页面传值
                    parent.$('.menuFunction').val($(this).attr('id'));
                    parent.layer.close(index);
                }
                $("#function-list").append(span);
            }
        }else{
            layer.msg(res.msg);
        }
    }, function (error) {
        layer.msg("获取功能列表失败");
    }, false);
</script>
</body>
</html>